package com.wlyuan.open.scanner.utils.enums.quotation;

import com.wlyuan.open.scanner.utils.NumberUtils;

import java.math.BigDecimal;
import java.util.Optional;

/**
 * @author lijing
 * @description
 */
public class QuotationMapping {

    public BigDecimal changeNull(BigDecimal value) {
        return NumberUtils.changeNull(value);
    }

    public Integer getQuotationSurchargeTypeValue(QuotationSurchargeTypeEnum value) {
        return Optional.ofNullable(value).map(QuotationSurchargeTypeEnum::getNewValue).orElse(null);
    }

    public QuotationSurchargeTypeEnum createQuotationSurchargeTypeValue(Integer value) {
        return Optional.ofNullable(QuotationSurchargeTypeEnum.fromValue(value)).orElse(QuotationSurchargeTypeEnum.OTHER);
    }

}
